package com.zhu.service.edu.controller.Front;

import com.zhu.commons.utils.R;
import com.zhu.service.edu.pojo.vo.SubjectVo;
import com.zhu.service.edu.service.IEduSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("api/front/subject")
@Api(tags = "subject前端api")

public class SubjectController {
    @Autowired
    private IEduSubjectService subjectService;

    @GetMapping("subjectList")
    @ApiOperation(value = "嵌套数据列表")
    public R subjectList(){
        List<SubjectVo> subjectVoList = subjectService.nestedList();
        if(subjectVoList!=null){
            return R.ok().data("items",subjectVoList);
        }
        return R.ok().message("数据不存在！");
    }
}
